package jarvis.fs;

import org.apache.lucene.index.Term;

/**
 * Function: The comparableterm class whose score value is a double
 * @author Jarvis.Guo
 *
 */
public class DoubleComparableTerm extends ComparableTerm {

	private double value;
	
	public DoubleComparableTerm(Term term,double value)
	{
		this.termText = term.text();
		this.value = value;
	}
	


	/* (non-Javadoc)
	 * @see jarvis.fs.ComparableTerm#compareTo(java.lang.Object)
	 */
	@Override
	public int compareTo(Object o) {
		DoubleComparableTerm fct = (DoubleComparableTerm) o;
		if(value==fct.value) return 0;
		if(value>fct.value) return -1;
		return 1;
	}

	/* (non-Javadoc)
	 * @see jarvis.fs.ComparableTerm#valueString()
	 */
	@Override
	public String valueString() {
		
		return String.valueOf(value);
	}

}
